<?php
/**
 * Created by PhpStorm.
 * Date: 2018/3/7
 * Time: 11:28
 */
namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Models\ShopCoupon;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use App\Http\Resources\ShopCoupon as ShopCouponResource;



class ShopCouponController extends ApiController
{
    /**
     * 获取代金券列表
     * @return mixed
     */
    public function getList(Request $request)
    {
//         $where = [
//             'uid' => \Auth::user()->id,
//         ];
        
        
//         if ($validator->fails()) {
//             return $this->failed($validator->errors(), 403);
//         }
//         if(empty(\Auth::user()->id)){
//             $user_id = 0;
//         }else{
//             $user_id = \Auth::user()->id;
//         }
        
        $user_id = 8;
        $list = ShopCoupon::getList(['user_id'=>$user_id]);
        return $this->success(ShopCouponResource::collection($list));
    }  
      

}